const { defineConfig } = require('@vue/cli-service')
const ModuleFederationPlugin =
  require('webpack').container.ModuleFederationPlugin
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    port: 9001,
  },
  configureWebpack: {
    plugins: [
      new ModuleFederationPlugin({
        name: 'app_application',
        filename: 'remoteEntry.js', // 指定打包后的文件名为remoteEntry.js
        // 暴露的模块
        // exposes: {
        //   './index': './src/main.ts',
        // },
        remotes: {
          app_environment:
            'app_environment@http://localhost:9002/remoteEntry.js',
          app_service: 'app_service@http://localhost:9003/remoteEntry.js',
        },
        shared: {
          vue: {
            singleton: true,
          },
        },
      }),
    ],
  },
})
